package cate.game.trace.sub;

import cate.common.game.trace.entity.RoleLevelUpLog;
import cate.common.game.trace.entity.RolePowerChangeLog;
import cate.game.role.Role;

import java.util.Date;

/** 【角色】追踪 (数据打点) */
public class TraceRole extends SubTrace {

    /** 当主角升级时 */
    public void onLevelUp(Role role) {
        RoleLevelUpLog l = new RoleLevelUpLog();
        l.roleId = role.getUid();
        l.level = role.getBase().level;
        l.ts = new Date();
        write(l);
    }

    /** 当主角战力发生改变时 */
    public void onPowerChange(Role role) {
        RolePowerChangeLog l = new RolePowerChangeLog();
        l.roleId = role.getUid();
        l.power = role.getBase().power;
        l.ts = new Date();
        write(l);
    }
}
